import type {user} from "@/request/types/user";
import {get, post} from "@/request/methods";
import store from "@/store";

//登录
export function Login(params: user) {
    return post('/user/login', params)
}

//注册
export function Register(params: user) {
    return post('/user/register', params)
}

//头像上传
export function uploadAvatar(params: any) {
    return post('/user/uploadAvatar', params, {headers: {'Content-Type': 'multipart/form-data'}})
}

//获取用户信息
export function getUserInfo() {
    return get('/user/getUserInfo',null,{headers:{'token': store.state.token}})
}

// 修改用户信息
export function exitNickName(params: any) {
    return post('/user/exitUserInfo', params)
}

export function exitSignatures(params: any) {
    return post('/user/exitSignatures', { signatures: params })
}

export function exitPassword(params: any) {
    return post('/user/exitPassword', params)
}

//退出登录
export function loginOut() {
    return post('/user/loginOut',null,{headers:{'token': store.state.token}})
}